<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机整数生成与显示</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }

        .container {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 400px;
        }

        button {
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 3px;
            cursor: pointer;
            margin-bottom: 10px;
        }

        textarea {
            width: 100%;
            height: 200px;
            padding: 10px;
            box-sizing: border-box;
        }
    </style>
    <script src="https://code.jquery.com/jquery-1.8.2.min.js"></script>
</head>

<body>
    <div class="container">
        <h2>随机整数生成</h2>
        <button id="generateButton">随机产生20个整数</button>
        <textarea id="resultTextarea"></textarea>
    </div>
    <script>
        $(document).ready(function () {
            $('#generateButton').click(function () {
                let numbers = [];
                for (let i = 0; i < 20; i++) {
                    let randomNumber = Math.floor(Math.random() * 9000 + 1000);
                    numbers.push(randomNumber);
                }
                numbers.sort((a, b) => a - b);
                $('#resultTextarea').val(numbers.join('\n'));
            });
        });
    </script>
</body>

</html>